package manager.data;

import java.nio.ByteBuffer;

import store.hibernate.Users;
import store.hibernate.Ws;
import store.hibernate.WsOperazione;

public class RawDataObject {
	private int 	size;
	private char 	direction;
	private long 	timestamp,
					seq_number;
	private byte[] 	key, 
					content,
					params = null, 
					keyInbound = null;
	private String 
					session, 
					username,
					operation, 
					WSNamespace, 
					password, 
					wsdlURL, 
					WSName;
	private Users userObject = null;
	private WsOperazione operationObject = null;
	private Ws wsObject = null;
	
	public RawDataObject(){
	}
	
	public RawDataObject(byte[] key, byte[] content){
		setKey(key);
		setContent(content);
		setSize(key.length+content.length);
	}

	public void setSize(int size){
		this.size=size;
	}

	public int getSize(){
		return size;
	}
	
	
	
	public void setKey(byte[] key){
		this.key=key;
	}
	
	public byte[] getKey(){
		return key;
	}
	
	public void setContent(byte[] content){
		this.content=content;
	}
	
	public byte[] getContent(){
		return content;
	}
	
	public void setDirection(byte[] direction){
		this.direction=Character.forDigit(direction[0] & 0xFF, 2);
		//System.out.println("dir: "+this.direction);
	}
	
	public char getDirection(){
		return direction;
	}

	public void setTimestamp(byte[] timestamp) {
		this.timestamp=ByteBuffer.wrap(timestamp).getLong();
		//System.out.println("time: "+this.timestamp);
	}
	
	public long getTimestamp(){
		return timestamp;
	}

	public void setSeqNumber(byte[] seq) {
		this.seq_number=ByteBuffer.wrap(seq).getLong();
		//System.out.println("seq: "+this.seq_number);
	}
	
	public long getSeqNumber(){
		return seq_number;
	}

	public void setSession(byte[] session) {
		this.session=new String(session);
		//System.out.println("session: "+this.session);
	}
	
	public String getSession(){
		return session;
	}

	public void setUsername(byte[] username) {
		this.username=new String(username);
		//System.out.println("user: "+this.username);
	}
	
	public String getUsername(){
		return username;
	}
	
	public void setUserObject(Users user) {
		this.userObject=user;
		//System.out.println("user: "+this.username);
	}
	
	public Users getUserObject(){
		return userObject;
	}
	
	public void setPassword(byte[] password) {
		this.password=new String(password);
		//System.out.println("pass: "+this.password);
	}
	
	public String getPassword(){
		return password;
	}

	public void setOperation(byte[] operation) {
		this.operation=new String(operation);
		//System.out.println("oper: "+this.operation);
	}
	
	public String getOperation(){
		return operation;
	}
	
	public void setOperationObject(WsOperazione oper) {
		this.operationObject=oper;
		//System.out.println("oper: "+this.operation);
	}
	
	public WsOperazione getOperationObject(){
		return operationObject;
	}
	
	public void setWSObject(Ws ws) {
		this.wsObject=ws;
		//System.out.println("name: "+this.WSNamespace);
	}
	
	public Ws getWSObject(){
		return wsObject;
	}

	public void setWSNamespace(byte[] WSNamespace) {
		this.WSNamespace=new String(WSNamespace);
		//System.out.println("name: "+this.WSNamespace);
	}
	
	public String getWSNamespace(){
		return WSNamespace;
	}
	
	public void setWSName(byte[] WSName) {
		this.WSName=new String(WSName);
		//System.out.println("nameWS: "+this.WSName);
	}
	
	public String getWSName(){
		return WSName;
	}
	
	public void setWSDLURL(byte[] wsdlURL) {
		this.wsdlURL=new String(wsdlURL);
		//System.out.println("wsdl: "+this.wsdlURL);
	}
	
	public String getWSDLURL(){
		return wsdlURL;
	}

	public void setParams(byte[] params) {
		this.params=params;
	}
	
	public byte[] getParams(){
		return params;
	}

	public void setKeyInbound(byte[] keyInbound) {
		this.keyInbound=keyInbound;
	}
	
	public byte[] getKeyInbound(){
		return keyInbound;
	}
}
